From: Keir Fraser Date: Fri, 29 Aug 2008 15:11:05 +0000 (+0100) Subject: x86: constify microcode hypercall argument X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14113^2~3 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=8565e53aba37c480486ba3b7ba6c00688d152360;p=xen.git x86: constify microcode hypercall argument Linux 2.6.27 marks the data pointer in its firmware struct 'const', and hence, to avoid a compiler warning, Xen's microcode update interface should be properly properly constified too. Signed-off-by: Jan Beulich --- diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c index 89138c9a79..d7882ea5b8 100644 --- a/xen/arch/x86/microcode.c +++ b/xen/arch/x86/microcode.c @@ -124,7 +124,7 @@ static DEFINE_SPINLOCK(microcode_update_lock); /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ static DEFINE_MUTEX(microcode_mutex); -static void __user *user_buffer; /* user area microcode data buffer */ +static const void __user *user_buffer; /* user area microcode data buffer */ static unsigned int user_buffer_size; /* it's size */ typedef enum mc_error_code { @@ -455,7 +455,7 @@ out: return error; } -int microcode_update(XEN_GUEST_HANDLE(void) buf, unsigned long len) +int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len) { int ret; diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c index b93dc71a23..571f412b04 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -147,8 +147,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op) case XENPF_microcode_update: { - extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len); - XEN_GUEST_HANDLE(void) data; + XEN_GUEST_HANDLE(const_void) data; ret = xsm_microcode(); if ( ret ) diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index d584d45b9e..aa03bda970 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -583,6 +583,8 @@ int rdmsr_hypervisor_regs( int wrmsr_hypervisor_regs( uint32_t idx, uint32_t eax, uint32_t edx); +int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len); + #endif /* !__ASSEMBLY__ */ #endif /* __ASM_X86_PROCESSOR_H */ diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h index 3f4fbfb661..742c0fc1c2 100644 --- a/xen/include/public/platform.h +++ b/xen/include/public/platform.h @@ -97,7 +97,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_read_memtype_t); #define XENPF_microcode_update 35 struct xenpf_microcode_update { /* IN variables. */ - XEN_GUEST_HANDLE(void) data; /* Pointer to microcode data */ + XEN_GUEST_HANDLE(const_void) data;/* Pointer to microcode data */ uint32_t length; /* Length of microcode data. */ }; typedef struct xenpf_microcode_update xenpf_microcode_update_t; diff --git a/xen/include/xen/compat.h b/xen/include/xen/compat.h index a2a4d6c2dd..86395d134e 100644 --- a/xen/include/xen/compat.h +++ b/xen/include/xen/compat.h @@ -19,7 +19,9 @@ type *_[0] __attribute__((__packed__)); \ } __compat_handle_ ## name -#define DEFINE_COMPAT_HANDLE(name) __DEFINE_COMPAT_HANDLE(name, name) +#define DEFINE_COMPAT_HANDLE(name) \ + __DEFINE_COMPAT_HANDLE(name, name); \ + __DEFINE_COMPAT_HANDLE(const_ ## name, const name) #define COMPAT_HANDLE(name) __compat_handle_ ## name /* Is the compat handle a NULL reference? */